/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package comum;

/**
 *
 * @author root
 */
public class ValidaUtil {

    private static ValidaUtil instance;
    char[] invalidChars = {':', '@', '!', '=', '/', '\\'};

    private ValidaUtil() {
    }

    public static ValidaUtil getInstance() {
        if (instance == null) {
            instance = new ValidaUtil();
        }
        return instance;
    }

    public boolean validaNick(String nickname) {
        boolean ret = true;
        for (char c : invalidChars) {
            if (nickname.contains("" + c)) {
                ret = false;
            }
        }
        if (nickname.contains("#")) {
            ret = false;
        }
        return ret;
    }

    public boolean validaCanal(String canal) {
        boolean ret = true;
        for (char c : invalidChars) {
            if (canal.contains("" + c)) {
                ret = false;
            }
        }
        if (!canal.startsWith("#")) {
            ret = false;
        }
        return ret;
    }
}
